﻿using Absky.Enum;

namespace Absky.Util
{
    /// <summary>
    /// Safari浏览器
    /// </summary>
    public class SafariBrowser : Browser
    {
        private readonly string _agent;

        public SafariBrowser(string agent)
        {
            _agent = agent.ToLower();
            var safari = BrowserTypeEnum.Safari.ToString().ToLower();

            if (_agent.Contains(safari))
            {
                var first = _agent.IndexOf(safari);
                var version = _agent.Substring(first + safari.Length + 1);
                Version = ToVersion(version);
                Type = BrowserTypeEnum.Safari;
            }
        }
    }
}
